#!/usr/bin/env python
#coding: utf-8
'''
Created on 2017年4月17日

@author: Administrator
'''

from comment.models import Comment
    
from django.db.models.signals import post_save
from django.dispatch import receiver
from comment.utils.es_comment import update_comment_to_es


@receiver(post_save, sender=Comment, dispatch_uid='comment.comment_save')
def comment_save_handler(sender, instance, raw, created, **kwargs):
    '''
    '''
    #更新es
    update_comment_to_es(instance)


def update_comment_by_user(user):
    '''
    function: 
    '''
    comments = Comment.objects.filter(user=user)
    update_comment_to_es(comments)
